package shared.units;

import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;

public class TankData{

	public final String name;
	
	public final float length;
	public final float height;
	public final float width;
	public final float mass;
	
	public final Vector3f spawnPosition;
	
	public final int maxPrimaryAmmunition;
	
	public final Vector3f centerOfGravity; //relative to the Center of the Tank
	
	public final float wheelRadius;
	public final float wheelWidth;
	
	public final float maxSteeringValue;
	public final float steeringSpeed;
	public final float maxAccelrationValue;
	public final float maxBrakeValue; 
		
	public final float restLength;
	public final float stiffness;
	public final float compValue;
	public final float dampValue;
	public final float maxSuspensionForce;
	
	public final float yOffset;
	public final float xOffset;
	public final float zOffset;
	
	public final String matDef;
	public final ColorRGBA color;
	
	
	public TankData(String name, float length, float height, float width, float mass, Vector3f centerOfGravity, float wheelRadius,
			float wheelWidth, float maxSteeringValue, float steeringSpeed, float maxAccelrationValue, float maxBrakeValue,
			float restLength, float stiffness, float compValue, float dampValue, float maxSuspensionForce, String matDef, ColorRGBA color) {
		super();
		this.name = name;
		this.length = length;
		this.height = height;
		this.width = width;
		this.mass = mass;
		this.centerOfGravity = centerOfGravity;
		this.wheelRadius = wheelRadius;
		this.wheelWidth = wheelWidth;
		this.maxSteeringValue = maxSteeringValue;
		this.steeringSpeed = steeringSpeed;
		this.maxAccelrationValue = maxAccelrationValue;
		this.maxBrakeValue = maxBrakeValue;
		this.restLength = restLength;
		this.stiffness = stiffness;
		this.compValue = compValue;
		this.dampValue = dampValue;
		this.maxSuspensionForce = maxSuspensionForce;
		this.matDef = matDef;
		this.color = color;
		this.maxPrimaryAmmunition = 42;
		this.spawnPosition = new Vector3f();

		yOffset = -centerOfGravity.y - ((height / 2f) + (wheelRadius / 1.5f));//length /2.5f;
		xOffset = (width / 2f) + (wheelWidth);
		zOffset = length /2.6f;
	}

	public TankData(int templateindex)
	{
		switch (templateindex)
		{
			default:
				this.name = "M1";
				this.length = 9.83f;
				this.height = 2.86f;
				this.width = 3.66f;
				this.mass = 400f;
				this.centerOfGravity = new Vector3f(0, -1, 0);
				this.wheelRadius = 0.5f;
				this.wheelWidth = 0.7f;
				this.maxSteeringValue = 500000f;
				this.steeringSpeed = 1f;
				this.maxAccelrationValue = 750f;
				this.maxBrakeValue = 25f;
				this.restLength = 1.0f;
				this.stiffness = 40f;
				this.compValue = 0.3f;
				this.dampValue = 0.4f;
				this.maxSuspensionForce = 100000f;
				this.matDef = "Common/MatDefs/Misc/Unshaded.j3md";
				this.color = ColorRGBA.Red;
				this.maxPrimaryAmmunition = 42;
				this.spawnPosition = new Vector3f(10, 0, 10);
				
				yOffset = -centerOfGravity.y - ((height / 2f) + (wheelRadius / 1.5f));//length /2.5f;
				xOffset = (width / 2f) + (wheelWidth);
				zOffset = length /2.6f;
				break;
		}
	}
	
}
